/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author Admin
 */
public class WebReader extends XPath {

    @Override
    public void setKeyDomain(String keyDomain) {
        WebReader.keyDomain = keyDomain;
    }

    public WebReader(String xmlFile, String loai, int stt, XPathReader rd) {
        this.xmlFile = xmlFile;
        this.eDomain = rd.getDomain(WebReader.keyDomain);
        if ("div".equals(loai)) {
            this.rootroot = rd.getRootroot(eDomain);
            this.root = rootroot + rd.getBRoot(eDomain) + stt + rd.getARoot(eDomain);
            this.link = this.root + rd.getLink(eDomain);
            this.title = this.root + rd.getTitle(eDomain);
            this.img = this.root + rd.getImg(eDomain);
            this.date = this.root + rd.getDate(eDomain);
            this.summary = this.root + rd.getSummary(eDomain);
        }
    }

    public WebReader(String xmlFile, String loai, XPathReader rd, String toCount) {

        this.xmlFile = xmlFile;
        this.eDomain = rd.getDomain(WebReader.keyDomain);
        if ("div".equals(loai)) {
            this.rootroot = rd.getRootroot(eDomain) + "/*";
        } else {
            this.rootroot = "//*[@id=\"col_left\"]/div[@id=\"box_list_news_sub\"]/div[@class=\"content_block\"]/ul[@class=\"list_news\"]/*";
        }
    }

    public WebReader() {
    }
}
